package kr.hyosang.dkbs.kiosk.factory;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;


public class StyleFactory {
	/**
	 * Reference : http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html
	 */
	private static final String FONT_NAME = "HCR Dotum";
	
	private static class Style {
		public static final String FONT_SIZE = "-fx-font-size";
		public static final String FONT_FAMILY = "-fx-font-family";
		public static final String FONT_COLOR = "-fx-text-fill";
		public static final String TEXT_OVERRUN = "-fx-text-overrun";
		public static final String BACKGROUND_COLOR = "-fx-background-color";
	}

	private static String generateStyleString(Map<String, String> csses) {
		StringBuffer sb = new StringBuffer();
		
		Set<Entry<String, String>> entries = csses.entrySet();
		for(Entry<String, String> entry : entries) {
			sb.append(String.format("%s:%s; ", entry.getKey(), entry.getValue()));
		}
		
		return sb.toString();
	}
	
	private static Map<String, String> getDefaultStringStyle() {
		HashMap<String, String> css = new HashMap<String, String>();
		css.put(Style.FONT_FAMILY, String.format("'%s'", FONT_NAME));
		
		return css;
		
	}
	
	
	public static String getDateStyle() {
		Map<String, String> style = getDefaultStringStyle();
		style.put(Style.FONT_SIZE, "20px");
		
		return generateStyleString(style);
	}
	
	public static String getTimeStyle() {
		Map<String, String> style = getDefaultStringStyle();
		style.put(Style.FONT_SIZE, "70px");
		style.put(Style.TEXT_OVERRUN, "clip");
		style.put(Style.BACKGROUND_COLOR, "#Ff0000");
		
		return generateStyleString(style);
	}
	
	public static String getTickerCategoryStyle() {
		Map<String, String> style = getDefaultStringStyle();
		style.put(Style.FONT_SIZE, "20px");
		
		return generateStyleString(style);
	}
	
	public static String getTickerTitleStyle() {
		Map<String, String> style = getDefaultStringStyle();
		style.put(Style.FONT_SIZE, "40px");
		
		return generateStyleString(style);
	}
	
	

}
